<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>在字符串中查找一组字符的任何一个字符</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.strpbrk" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">strpbrk</h1>
  <p class="verinfo">(PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">strpbrk</span> &mdash; <span class="dc-title">在字符串中查找一组字符的任何一个字符</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.strpbrk-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>strpbrk</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$haystack</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$char_list</code></span>
   ) : <span class="type">string</span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>strpbrk()</strong></span> 函数在 <code class="parameter">haystack</code> 字符串中查找 <code class="parameter">char_list</code> 中的字符。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.strpbrk-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">haystack</code></dt>

     <dd>

      <p class="para">
       在此字符串中查找 <code class="parameter">char_list</code>。
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">char_list</code></dt>

     <dd>

      <p class="para">
       该参数区分大小写。
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.strpbrk-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   返回一个以找到的字符开始的子字符串。如果没有找到，则返回 <strong><code>FALSE</code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.strpbrk-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-5973">
    <p><strong>Example #1 <span class="function"><strong>strpbrk()</strong></span> 范例</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$text&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'This&nbsp;is&nbsp;a&nbsp;Simple&nbsp;text.'</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">//&nbsp;输出&nbsp;"is&nbsp;is&nbsp;a&nbsp;Simple&nbsp;text."，因为&nbsp;'i'&nbsp;先被匹配<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">strpbrk</span><span style="color: #007700">(</span><span style="color: #0000BB">$text</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'mi'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;输出&nbsp;"Simple&nbsp;text."，因为字符区分大小写<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">strpbrk</span><span style="color: #007700">(</span><span style="color: #0000BB">$text</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'S'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

   </div>
  </p>
 </div>



 <div class="refsect1 seealso" id="refsect1-function.strpbrk-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="strpos.html" class="function" rel="rdfs-seeAlso">strpos()</a> - 查找字符串首次出现的位置</span></li>
    <li class="member"><span class="function"><a href="strstr.html" class="function" rel="rdfs-seeAlso">strstr()</a> - 查找字符串的首次出现</span></li>
    <li class="member"><span class="function"><a href="preg_match.html" class="function" rel="rdfs-seeAlso">preg_match()</a> - 执行匹配正则表达式</span></li>
   </ul>
  </p>
 </div>

</div></div></div></body></html>